home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1990: Discy Business / Discy Business.2mg / DEV.CD / TOOLS / SAMPLES / HP / HP.ASM / GLOBALS.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-03-24  |  7.5 KB  |  255 lines  |  [B0] Apple IIgs Source Code (0x0003)

  1.  
  2. ******************************************************************************
  3. *                                                                            *
  4. *         HodgePodge:  An example Apple IIGS Desktop application             *
  5. *                                                                            *
  6. *         Written in 65816 Assembler by the Apple IIGS Tools Team            *
  7. *  Modified by Ben Koning for "Programmer's Introduction to the Apple IIGS"  *
  8. *                                                                            *
  9. *             Copyright (c) 1986-87 by Apple Computer, Inc.                  *
  10. *                                                                            *
  11. *   ----------------------------------------------------------------------   *
  12. *                                                                            *
  13. *  ASM65816 Code file "GLOBALS.ASM" -- Global variables and misc. routines   *
  14. *                                                                            *
  15. ******************************************************************************
  16.  
  17.  
  18.  
  19. ****************************************************************
  20. *
  21. * GlobalDATA
  22. *
  23. ****************************************************************
  24. GlobalData     DATA
  25.  
  26.  
  27. Prompt         dc i1'19',c'Load which Picture:'
  28. Prompt2        dc i1'19',c'Save which Picture:'
  29. Wxoffset       dc i'20'     ; offset for upperleft window corner
  30. Wyoffset       dc i'12'     ; offset for upperleft window corner
  31.  
  32. nullRect       dc i'0,0,0,0'
  33.  
  34. reply          anop                     ;SF GET/PUT FILE record
  35. r_good         dc i2'0'
  36. r_type         dc i2'0'
  37. r_auxtyp       dc i2'0'
  38. r_fname        ds 16
  39. r_fullpn       ds 128
  40.  
  41. QuitParams     dc i4'0'
  42.                dc i'$4000'              ; am restartable in memory
  43.  
  44.  
  45. ; ToolTable      dc i'11'
  46. ;              dc i'4,$0101'            ; quickdraw
  47. ;              dc i'5,$0100'            ; desk manager
  48. ;              dc i'6,$0100'            ; event manager
  49. ;              dc i'14,$0103'           ; window manager from disk!
  50. ;              dc i'15,$0103'           ; menu manager from Disk!
  51. ;              dc i'16,$0103'           ; control manager form disk!
  52. ;              dc i'20,$0100'           ; line edit
  53. ;              dc i'21,$0100'           ; dialog manager from disk!
  54. ;              dc i'23,$0100'           ; standard files from disk!
  55. ;              dc i'27,$0100'           ; Font manager
  56. ;              dc i'28,$0000'           ; List manager
  57.  
  58. ; ThisMode       dc i'$0080'              ;init mode: 640
  59.  
  60. Srcinfo320     dc i'$00'                ;PPtoPort 320 parms
  61. PicPtr320      ds 4
  62.                dc i'160'
  63.                dc i'0,0,200,320'
  64.  
  65. SrcRect320     dc i'0,0,200,320'
  66.  
  67. SrcLocInfo     dc i'$80'                ;PPtoPort 640 parms
  68. PicPtr         ds 4
  69.                dc i'160'
  70.                dc i'0,0,200,640'
  71.  
  72. SrcRect        dc i'0,0,200,640'
  73.  
  74. EventRecord    anop
  75. EventWhat      ds 2
  76. EventMessage   ds 4
  77. EventWhen      ds 4
  78. EventWhere     ds 4
  79. EventModifiers ds 2
  80.  
  81. TaskDATA       ds 4
  82. TaskMask       dc i4'$0FFF'
  83.  
  84. QuitFlag       ds 2
  85. DialogPtr      ds 4
  86. Windex         ds 2                     ;Index to next avail.window ID
  87. LastWind       gequ 15                  ;Maximum number of windows open
  88. MyZP           ds 2
  89. ; ZpHandle       ds 4
  90. ; MyID           ds 2
  91.  
  92. Vindex         ds 2                     ;index used to list of what WAS visible
  93. Vtable         ds 16*4                  ;list of what WAS vis. when Hiding all
  94. WindowList     ds 16*4                  ;all windows handle go into this list
  95. WhichWindow    ds 4                     ;will contain window pointer, cur. window
  96. TempHandle     ds 4                     ;some temp handles
  97. Temp2Handle    ds 4
  98. PicHandle      ds 4                     ; handle to picture data
  99. ;OrigPort       ds 4
  100. SaveType       ds 2
  101. ActivateFlag   ds 2                     ;flag for check front window.
  102. NeedToUpdate   ds 2                     ;used to prevent multi menu redraws
  103. ThisWType      ds 2
  104. LastWtype      ds 2
  105. PrintAvail     dc i'0'                  ;Make sure this starts as 0
  106.  
  107. PrintRecord    ds 4                     ; handle to print record
  108. PrintPort      ds 4                     ; pointer to printing GrafPort.
  109.  
  110.  
  111.  
  112. VolNotFound    gequ $45                 ; prodos error
  113.  
  114.  
  115. ;------------------------------------------------------------
  116. ;
  117. ; MyWindowInfo
  118. ;
  119. ; This is the data structure used for the windows we
  120. ; allocate.
  121. ;
  122. MaxNameSize    equ 29                   ; largest name we allow
  123.  
  124. oHandle        equ 0
  125. oBlank         equ oHandle+4
  126. oLength        equ oBlank+1
  127. oName          equ oLength+1
  128. oMMStuff       equ oName+MaxNameSize
  129. oFlag          equ oMMStuff+6
  130. oExtra         equ oFlag+1
  131. ;
  132. oFontID        equ oHandle              ; if the type is for font,
  133. ;                                       ; the first field is a FontID
  134. ;                                       ; rather than the handle to picture
  135. ;                                       ; data.
  136.  
  137. MyWinfoSize    equ oExtra+4
  138.  
  139.                END
  140.  
  141. ****************************************************************
  142. *
  143. * IOData
  144. *
  145. ****************************************************************
  146. IOData       DATA
  147.  
  148. CreateParms  anop
  149. NameC    dc    i4'0'
  150.          dc    i2'$00C3'                ; DRNWR
  151. CType    dc    i2'$0006'                ; BIN
  152. CAux     dc    i4'$00000000'            ; Aux.
  153.          dc    i2'$0001'                ; type
  154.          dc    i2'$0000'                ; create date
  155.          dc    i2'$0000'                ; create time
  156.  
  157. DestParams     anop
  158. NameD          dc    i4'0'
  159.  
  160. OpenParams     anop
  161. OpenID         ds 2
  162. NamePtr        ds 4
  163.                ds 4
  164.  
  165. ReadParams     anop
  166. ReadID         ds 2
  167. PicDestIN      ds 4
  168.                dc i4'$8000'             ; this many bytes
  169.                ds 4                     ; how many xfered
  170.  
  171. PReadParams    anop                     ; for reading a packed file
  172. PReadID        ds 2
  173. PReadLoc       ds 4
  174. PReadSize      ds 4                     ; this many bytes
  175.                ds 4                     ; how many xfered
  176.  
  177. MarkParams     anop
  178. MarkID         ds 2
  179. CurrentMark    anop
  180. Mark           ds 4
  181.  
  182. WriteParams    anop
  183. WriteID        ds 2
  184. PicDestOUT     ds 4
  185.                dc i4'$8000'             ; this many bytes
  186.                ds 4                     ; how many xfered
  187.  
  188. PackWParams    anop
  189. PackWID        ds 2
  190. PackWDest      ds 4
  191. HowMany        ds 4                     ; this many bytes
  192.                ds 4                     ; how many xfered
  193.  
  194. CloseParams    anop
  195. CloseID        ds 2
  196.  
  197.                END
  198.  
  199.  
  200.  
  201. ****************************************************************
  202. *
  203. * Ignore
  204. *
  205. * Does not do a whole lot.
  206. *
  207. ****************************************************************
  208. Ignore         START
  209.                rts
  210.                END
  211.  
  212. ****************************************************************
  213. *
  214. * Deref
  215. *
  216. * Derefs and locks the handle passed in a,x.  Result passed back
  217. * in a,x. Trashes 0 on zp.
  218. *
  219. ****************************************************************
  220. Deref          START
  221.                sta 0
  222.                stx 2
  223.                ldy #4
  224.                lda [0],y
  225.                ora #$8000
  226.                sta [0],y
  227.                dey
  228.                dey
  229.                lda [0],y
  230.                tax
  231.                lda [0]
  232.                rts
  233.  
  234.                END
  235.  
  236.  
  237. ****************************************************************
  238. *
  239. * Unlock
  240. *
  241. * Unlocks the handle passed in x and a.  0 is trashed on zp.
  242. *
  243. ****************************************************************
  244. Unlock         START
  245.  
  246.                sta 0
  247.                stx 2
  248.                ldy #4
  249.                lda [0],y
  250.                and #$7FFF
  251.                sta [0],y
  252.                rts
  253.  
  254.                END
  255.